package com.dailyblue.java.project.bookstore.author.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class JsonResult<T> implements Serializable {
    private Integer code;
    private String message;
    private T data;

    public JsonResult(T data) {
        this.data = data;
        this.code = 200;
    }

    public JsonResult(ResultCode code) {
        this.code = code.getCode();
        this.message = code.getMessage();
    }
}
